<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <!--以下是在线编辑器 代码 -->
    <style type="text/css">
        .form-control{height:auto;}
        .text-warning input{border:none; width:240px;}
    </style>
    <?php $myurl="https://".$_SERVER['SERVER_NAME'];?>
    <script type="text/javascript">
        /*
         * 在线编辑器相 关配置 js
         *  参考 地址 http://fex.baidu.com/ueditor/
         */
        window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
        var URL_upload = "{$myurl}{$URL_upload}";
        var URL_fileUp = "{$myurl}{$URL_fileUp}";
        var URL_scrawlUp = "{$myurl}{$URL_scrawlUp}";
        var URL_getRemoteImage = "{$myurl}{$URL_getRemoteImage}";
        var URL_imageManager = "{$myurl}{$URL_imageManager}";
        var URL_imageUp = "{$myurl}{$URL_imageUp}";
        var URL_getMovie = "{$myurl}{$URL_getMovie}";
        var URL_home = "{$myurl}{$URL_home}";
        var URL_Config = "{$myurl}/Admin/Ueditor/getConfig";
    </script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">

        // var editor;
        // $(function () {
        //     //具体参数配置在  editor_config.js  中
        //     var options = {
        //         zIndex: 999,
        //         initialFrameWidth: 750, //初化宽度
        //         initialFrameHeight: 400, //初化高度
        //         focus: false, //初始化时，是否让编辑器获得焦点true或false
        //         maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
        //         , //允许的最大字符数 'fullscreen',
        //         pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
        //         autoHeightEnabled: true
        // 		,
        //     	toolbars: [
        //                ['fullscreen', 'source', '|', 'undo', 'redo',
        //                    '|', 'bold', 'italic', 'underline', 'fontborder',
        //                    'strikethrough', 'superscript', 'subscript',
        //                    'removeformat', 'formatmatch', 'autotypeset',
        //                    'blockquote', 'pasteplain', '|', 'forecolor',
        //                    'backcolor', 'insertorderedlist',
        //                    'insertunorderedlist', 'selectall', 'cleardoc', '|',
        //                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
        //                    'customstyle', 'paragraph', 'fontfamily', 'fontsize',
        //                    '|', 'directionalityltr', 'directionalityrtl',
        //                    'indent', '|', 'justifyleft', 'justifycenter',
        //                    'justifyright', 'justifyjustify', '|', 'touppercase',
        //                    'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
        //                    'imagenone', 'imageleft', 'imageright', 'imagecenter',
        //                    '|', 'insertimage', 'emotion', 'insertvideo',
        //                    'attachment', 'map', 'gmap', 'insertframe',
        //                    'insertcode', 'webapp', 'pagebreak', 'template',
        //                    'background', '|', 'horizontal', 'date', 'time',
        //                    'spechars', 'wordimage', '|',
        //                    'inserttable', 'deletetable',
        //                    'insertparagraphbeforetable', 'insertrow', 'deleterow',
        //                    'insertcol', 'deletecol', 'mergecells', 'mergeright',
        //                    'mergedown', 'splittocells', 'splittorows',
        //                    'splittocols', '|', 'print', 'preview', 'searchreplace']
        //            ]
        //     };
        //     editor = new UE.ui.Editor(options);
        //     editor.render("smtp1_content");  //  指定 textarea 的  id 为 goods_content
        //     try {
        //         //添加自定义类名content,用于设置编辑器里的样式
        //         editor.addListener('ready', function (editor) {
        // 		var aa=$('#ueditor_0').contents().find('body').attr('id','shadow');
        //         });
        //     } catch (err) {}
        // });

        var ue = UE.getEditor('smtp1_content', {
            // ... 更多配置
            serverUrl:URL_Config
        });
    </script>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-body ">
                    <ul class="nav nav-tabs">
                        <foreach name="group_list" item="vo" key="k">
                            <li <if condition="$k eq 'smtp1'">class="active"</if>><a href="javascript:void(0)" data-url="{:U('System/index',array('inc_type'=>$k))}" data-toggle="tab" onclick="goset(this)">{$vo}</a></li>
                        </foreach>
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="handlepost" action="{:U('System/handle')}">
                        <!--通用信息-->
                        <div class="tab-content" style="padding:20px 0px;">
                            <div class="tab-pane active" id="tab_smtp">
                                <table class="table table-bordered">
                                    <tbody>
                                    <tr>
                                        <td colspan="2"><p class="text-warning">
                                            店铺链接：<input value="/pages/store/index?store_id="/>
                                            &nbsp;&nbsp;产品链接：<input value="/pages/goods_details/goods_details?id=" style="width: 300px;"/><br/>
                                            店铺专区：<input value="/pages/index/zhuanqu?types=1"/>
                                            &nbsp;&nbsp;产品专区：<input value="/pages/index/zhuanqu?types=2"/>
                                        </p></td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2">底纹颜色：</td>
                                        <td class="col-sm-8">
                                            <input type="text" class="form-control" name="smtp_bg" value="{$config.smtp_bg}" style="width: 120px;">
                                            <span id="err_attr_name" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2">活动版面设计：</td>
                                        <td class="col-sm-8">
                                            <textarea class="form-control" id="smtp1_content" name="smtp1_content">{$config.smtp1_content}</textarea>
                                            <p class="text-warning">先在ps切图，导出html再复制到此编辑器进行连接编辑。</p>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td><input type="hidden" name="inc_type" value="{$inc_type}"></td>
                                        <td class="text-right"><input class="btn btn-primary" type="button" onclick="adsubmit()" value="保存"></td></tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>

<script>
    var flag = true;
    function adsubmit(){
        if(flag){
            $('#handlepost').submit();
        }
    }

    $(document).ready(function(){
        get_province();
    });

    function goset(obj){
        window.location.href = $(obj).attr('data-url');
    }

    function sendEmail(){
        if($('input[name="test_eamil"]').val() == '' || !checkEmail($('input[name="test_eamil"]').val())){
            alert('请填写正确的测试邮箱账号');
            return;
        }else{
            $.ajax({
                type : "post",
                data : $('#handlepost').serialize(),
                dataType : 'json',
                url : "{:U('System/send_email')}",
                success : function(res){
                    if(res==1){
                        layer.msg('发送成功', {icon: 1});
                    }else{
                        layer.msg('发送失败', {icon: 2,time: 2000});
                    }
                }
            })
        }
    }
</script>
</body>
</html>